package com.cgwx.entity;

import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
import java.sql.Timestamp;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("fs_file")
@ApiModel(value="File对象", description="")
@Getter
@Setter
public class File implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "entity_id", type = IdType.AUTO)
    private String entityId;

    private String entityName;

    private String entityRoom;

    private String ownerAccount;

    private String ownerName;

    private String parentId;

    private String fileId;

    private String fileUrl;

    private String versionId;

    private String type;

    private String tag;

    private float fileSize;

    private String isDeleted;

    private int downloadTimes;

    private int viewTimes;

    private String isOuter;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Timestamp createTime;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Timestamp updateTime;

    @Override
    public String toString() {
        return "File{" +
                "entityId='" + entityId + '\'' +
                ", entityName='" + entityName + '\'' +
                ", entityRoom='" + entityRoom + '\'' +
                ", ownerAccount='" + ownerAccount + '\'' +
                ", ownerName='" + ownerName + '\'' +
                ", parentId='" + parentId + '\'' +
                ", fileId='" + fileId + '\'' +
                ", fileUrl='" + fileUrl + '\'' +
                ", versionId='" + versionId + '\'' +
                ", type='" + type + '\'' +
                ", tag='" + tag + '\'' +
                ", fileSize=" + fileSize +
                ", isDeleted='" + isDeleted + '\'' +
                ", downloadTimes=" + downloadTimes +
                ", viewTimes=" + viewTimes +
                ", isOuter=" + isOuter +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }

    public File() {
    }

    public File(Folder folder){
        this.entityId = folder.getEntityId();
        this.entityName = folder.getEntityName();
        this.entityRoom = folder.getEntityRoom();
        this.ownerAccount = folder.getOwnerAccount();
        this.ownerName = folder.getOwnerName();
        this.parentId = folder.getParentId();
        this.type = folder.getType();
        this.tag = folder.getTag();
        this.isDeleted = folder.getIsDeleted();
        this.createTime = folder.getCreateTime();
        this.updateTime = folder.getUpdateTime();
    }

}
